home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / mtgrap1c / mtgraph.doc < prev    next >
Text File  |  1994-08-06  |  52KB  |  953 lines

  1.  
  2.  
  3.  
  4.  
  5.                      Neuromancer Software
  6.                                
  7.  
  8.                            Presents
  9.  
  10.  
  11.            ┌───────────────────────────────────────┐
  12.            │ mtGraph Mode13h Graphics Toolkit 1.0c │
  13.            └───────────────────────────────────────┘
  14.  
  15.                  Release Date :  6th August 1994
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.                 Copyright 1994 Tay Choon Heong
  24.    
  25.                     Draft : 28th June 1994
  26.              
  27.                    Revised : 6th August 1994
  28.  
  29.  
  30.                                
  31.  
  32. ┌────────────┬───────────────────────────────────────────────┐
  33. │ Disclaimer │                                               │
  34. └────────────┴───────────────────────────────────────────────┘
  35.                                                              
  36. As with standard disclaimer, this product is provided on an  
  37. "as-is" basis, and the author makes no warranty or          
  38. representation, express or implied, with respect to its quality
  39. performance or fitness for a particular purpose. In no event will
  40. the author of this document be liable for direct, indirect,  
  41. special, incidental, or consequential damages arising out of the
  42. use or inability to use the information contained within.    
  43.                                                              
  44. This beta version is hereby released "AS IT IS" to the interested
  45. users and no warranty will be provided.  Use of this product is
  46. at your own risk.                                            
  47.                                                              
  48. However, if you have got any queries or bugs report, you are most
  49. welcome to contact me at the following address :             
  50.                                                              
  51.                                                              
  52.      Address   : Tay Choon Heong                             
  53.                  Blk 201, Toa Payoh North                    
  54.                  #02-1063,                                   
  55.                  Singapore 1231                              
  56.                                                              
  57.      Tel       : 2 5 0 8 6 5 8                               
  58.                                                              
  59.      email     : chtay@iti.gov.sg
  60.                 
  61.                                                              
  62. ┌─────────┬──────────────────────────────────────────────────┐
  63. │ Preface │                                                  │
  64. └─────────┴──────────────────────────────────────────────────┘
  65.                                                              
  66.                                                              
  67. It all started out with XLIB and YAKICONS.                   
  68.                                                              
  69. I have always wanted to develop my own game, me being an addict
  70. to the fantastic computer animation commercials I have seen on
  71. TV. After reading the newsgroup in the internet, I came to know
  72. of the several graphical libraries which are very useful for this
  73. purpose. WGT, SPX, XLIB, YAKICONS and VGL20 immediately spring
  74. to mind. However, as I realised later, some of these packages are
  75. shareware. Being a student, I was unable to fork out the money
  76. to register the package so I was left with the latter three
  77. packages.                                                    
  78.                                                              
  79. Although they are not shareware packages, XLIB,YAKICONS and
  80. VGL20 are excellent packages with full source codes provided.
  81. XLIB is developed around Mode X with Yakicons being a class
  82. library built on XLIB. VGL20 on the other hand supports mode13h.
  83. They provided me with the development toolkits which are more
  84. than adequate to satisfy my needs. As a standard routine
  85. pertaining to my starting a project, I started to read up on
  86. Mode X and it was brought to my attention that Mode X involved
  87. tweaking with some VGA registers. I read somewhere that it was
  88. "dangerous" to tweak the VGA registers and I began to worry if
  89. it is safe to use it.
  90.                                                              
  91. So, I was quite depressed at that time .. until someone (I
  92. believe it was Joshua Hightower..) pointed me to some excellent
  93. documents written by Grant Smith. That started me on the idea of
  94. developing my own library. I began to source for information on
  95. this subject; assembly language tutorials, Game Developer's
  96. Magazine, PC Game Programming Encyclopedia, VGL20 etc. All these
  97. have been a great help to me and my thanks to the authors!
  98. However, one person had been most helpful to me and has been
  99. helping me since I started. Here, I would like to take this
  100. chance to thank Goran Devic for his support! The result is this
  101. graphical library that you have in your possession.            
  102.         
  103.                                                              
  104. Finally, I would like to thank you for your interest in the
  105. mtGraph mode 13h graphical toolkit library.                  
  106.                                                              
  107.                                                              
  108.                                                              
  109.                                                              
  110. Yours sincerely                                              
  111.                                                              
  112. Tay Choon Heong                                              
  113.                                                              
  114. 5th July 1994                                                
  115.  
  116.                                                              
  117.                                                              
  118. ┌─────────────────┬──────────────────────────────────────────┐
  119. │ Acknowledgement │                                          │
  120. └─────────────────┴──────────────────────────────────────────┘
  121.  
  122. I would acknowledge my heartfelt gratitude to the following
  123. people who had helped me when I started work on my graphical
  124. library. I have forgotten to acknowledge Mark Morley in my
  125. previous release of the documents and I apologise for my neglect.
  126.  
  127.  
  128.      Goran Devic, who had really helped me a great deal in my
  129.      "quest"!    
  130.  
  131.      Smith Grant, who developed the excellent VGA trainers that
  132.      started me on the idea of developing my own library.
  133.  
  134.      Joshua Hightower, who mailed me a lot of information on
  135.      VGA/MCGA programing techniques.
  136.  
  137.      Mark Morley, who has contributed his codes for the VGL20
  138.      library to the internet.
  139.  
  140.      Tim Kientzle, who helped me with the ellipse routine and
  141.      graciously allowed me to incorporate his ellipse routine in
  142.      my library.
  143.  
  144.      Chris/Barry Egerter, for allowing me to use the WGT sprite
  145.      format in my library.
  146.  
  147.      Others, whom I have neglected to acknowledge in this beta
  148.      document.
  149.  
  150.                                                              
  151. ┌──────────────┬─────────────────────────────────────────────┐
  152. │ Introduction │                                             │
  153. └──────────────┴─────────────────────────────────────────────┘
  154.  
  155.                                                              
  156. The mtGraph toolkit is developed around the VGA Mode13h graphic
  157. mode for the purpose of creating games. It is with great hope
  158. that this toolkit will eventually become a complete toolkit for
  159. game development but right now, it can only provide simple
  160. graphical primitives. If anyone would like to contribute their
  161. codes or help to develop the library or merely provide
  162. suggestions, please please let me know!                        
  163.                                                                
  164. The mtGraph toolkit supports the Mode 13h video mode on the PC.
  165. The screen resolution of this is 320x200 pixels where one byte
  166. represents one pixel. Although the screen resolution may be a bit
  167. coarse, this mode allows a palette of 256 colours to be displayed
  168. and it is the most commonly used video mode in games. With this
  169. in mind, the routines developed will require that the mode 13h
  170. video mode is set up correctly. No checking is done at this stage
  171. of the development but this may be corrected in future version.
  172. The following lists the features of this toolkit.            
  173.  
  174.  
  175.                                                              
  176. ┌───────────┬────────────────────────────────────────────────┐
  177. │ Features: │                                                │ 
  178. └───────────┴────────────────────────────────────────────────┘
  179. o    Routines for entering and exiting Mode 13h video mode.  
  180.                                                              
  181. o    Function to set a clip region.                          
  182.                                                              
  183. o    Palette routines to load and save table of palette to the
  184.      harddisk, change the VGA palette, fade in and fade out the
  185.      VGA palette with user-defined delay.                    
  186.                                                              
  187. o    Simple mouse handler with an option to change the cursor.
  188.                                                              
  189. o    Pixel plotting routines. Supports clipping.             
  190.                                                              
  191. o    Line routines: horizontal, vertical and bresemham. Supports
  192.      clipping.                                               
  193.                                                              
  194. o    Rectangle routines: outline and filled. Supports clipping.
  195.                                                              
  196. o    Circle and ellipse: outline and filled. Supports clipping.
  197.      I would like to thank Tim Kientzle for use of his ellipse
  198.      algorithm.                                              
  199.                                                              
  200. o    Setting up virtual screens: These are the most essential
  201.      routines if you are looking for smooth, flicker-free    
  202.      animations. Simple routines are provided for setting up 
  203.      several virtual pages, selecting which pages to be the  
  204.      active page, copying hidden page to the active page,    
  205.      copying page to page, copying partial block to different
  206.      location (may it be on the same page or different page).
  207.                                                         
  208. o    Image block routines: Allows a bitmap to be copied to the
  209.      active page. Several routines are provided: copy without
  210.      clipping, copy transparently without clipping (color 0 not
  211.      drawn) and the other two supports clipping. Further
  212.      enhancement may provide XOR mode.                       
  213.  
  214. o    Sprite loading routines: routines are provided to allow 
  215.      users to allow user-created bitmaps to be loaded and saved.
  216.      Additional routines are provided to allow users to access
  217.      the WGT sprite files and convert them to the mtGraph sprite
  218.      files. These sprite files can then be passed to the image
  219.      block routine to be displayed.                          
  220.                                                              
  221. o    Font support: Routines are provided to allow different font
  222.      types to be loaded. As the font types are simply bitmap,
  223.      user can easily develop new font type. At the time of   
  224.      writing, only one system font type is provided. The text color
  225.      can be modified. An font editor is planned for future release.                   
  226.                                                              
  227. o    Miscellaneous: routine to wait for vertical retrace, PCX
  228.      loader, keyboard handler.                                 
  229.                                                                
  230.  
  231. The Borland products ( C++ Version 3.1) were used for developing
  232. this toolkit. Most of the routines in the toolkit were developed
  233. in either assembly using 80286 codes or C/C++. The reason 286
  234. codes were used was to allow users with 286 computers to use the
  235. toolkit as well. As they were coded using the Borland compiler
  236. and assembler, other products may not be able to compile the
  237. codes.
  238.                                                              
  239.                                                              
  240.      Development Base                                        
  241.      ================                                        
  242.      Intel 486 66Mhz                                         
  243.      Borland C++ compiler                                    
  244.      Turbo Assembler                                         
  245.      Memory 8Mb                                              
  246.                                                              
  247.                                                              
  248. ┌───────────────────────────┬────────────────────────────────┐
  249. │ Using the mtGraph Library │                                │
  250. └───────────────────────────┴────────────────────────────────┘
  251.                                                              
  252. First of all, you will have to check out the release version of
  253. the mtGraph library that you have. Some of the files may not be
  254. able to compile with an earlier version of the mtGraph library
  255. as changes are constantly being done to the library. To determine
  256. what is the current version, either refer to this document or
  257. observe the release version of the supplied demonstration file
  258. (mtdemo.exe) and the released date located at the lower right end
  259. of the information box. For some reason, the release version may
  260. be the same but there might be some changes (very minor) to the
  261. libraries, so it is important to check the release date as well
  262. (*grin* just in case.) If you got an earlier version, you might
  263. have not be able to compile your programs. 
  264.  
  265.  
  266. To use the mtGraph library, all you need to do is to create a
  267. project file add the mtlibxx.lib and your program file into the
  268. project file. It is that simple. Otherwise, you can make use of
  269. the makefile provided with the examples and modify accordingly.
  270. If you are using the Borland C IDE, go to the Option menu.
  271. Select the debugger option and put the program heap size to
  272. around 200K. Once this is done, merely type alt C-M/alt C-R or
  273. type MAKE at the C> prompt to create the EXE file. If you are
  274. using the makefile, make sure that all the include files are in
  275. the same directory as your development directory. Otherwise,
  276. modify your makefile or project files accordingly. 
  277.  
  278. Ok .. enough of all the information crap, now let's get on with
  279. the programming. In the following section, all the functions
  280. available in the  mtGraph toolkit will be listed. Admittedly, it
  281. is horrible piece of a document but that is the best I can rush
  282. out. It will be touched up as and when I find the time...:)
  283.                
  284.  
  285. IMPORTANT ADDITION : If you are using the Borland C IDE, set the
  286. program heap size to around 200K. This can be found under the
  287. Option menu in the debugger option. If this is not set, the
  288. program will not work properly.  
  289.                                                              
  290.                                                                                                                           
  291. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  292. ▒                                                            ▒
  293. ▒ Video Routines                                             ▒
  294. ▒                                                            ▒
  295. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  296.                                                              
  297.                                                              
  298. ┌────────────────────────────────────────────────────────────┐
  299. │ void    mtSetVGAMode(void)                                 │
  300. └────────────────────────────────────────────────────────────┘
  301.           set up the mode 13h video modes                    
  302.                                                                
  303.                                                           
  304. ┌────────────────────────────────────────────────────────────┐
  305. │ void    mtSetTextMode(void)                                │
  306. └────────────────────────────────────────────────────────────┘
  307.           exit mode 13h and return to the inital text mode   
  308.                                                              
  309.                                                              
  310. ┌────────────────────────────────────────────────────────────┐
  311. │ void    mtSetWindow(int x1,int y1,int x2,int y2)           │
  312. └────────────────────────────────────────────────────────────┘
  313.           set up a clip region                               
  314.  
  315.  
  316. ┌────────────────────────────────────────────────────────────┐
  317. │ void    mtResetWindow(void)                                │
  318. └────────────────────────────────────────────────────────────┘
  319.           reset the clip region to full screen                                     
  320.                                                              
  321.                                                              
  322. ┌────────────────────────────────────────────────────────────┐
  323. │ void    mtClrScr(int color)                                │
  324. └────────────────────────────────────────────────────────────┘
  325.           Depending on the clip region, it will clear the screen
  326.           with the user-defined colour.                      
  327.                                                                
  328.                                                           
  329. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  330. ▒                                                            ▒
  331. ▒ Page Routines                                              ▒
  332. ▒                                                            ▒
  333. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  334.                                                              
  335.                                                              
  336. ┌────────────────────────────────────────────────────────────┐
  337. │ block   mtAllocPage(int x1,int y1,int x2,int y2)           │
  338. └────────────────────────────────────────────────────────────┘
  339.           set up the virtual screens                         
  340.  
  341.  
  342. ┌────────────────────────────────────────────────────────────┐
  343. │ void      mtFreePage(block page)                            
  344. └────────────────────────────────────────────────────────────┘
  345.           free the virtual screens                            
  346.                                                              
  347.                                                              
  348. ┌────────────────────────────────────────────────────────────┐
  349. │ int     mtSetPage(block page)                              │
  350. └────────────────────────────────────────────────────────────┘
  351.           set up the active page                             
  352.                                                              
  353.                                                              
  354. ┌────────────────────────────────────────────────────────────┐
  355. │ int     mtFlipPage(block page)                             │
  356. └────────────────────────────────────────────────────────────┘
  357.           flip the hidden page to the screen                 
  358.  
  359.                                                              
  360. ┌────────────────────────────────────────────────────────────┐
  361. │ int     mtCopyPage(block src,block dest)                   │
  362. └────────────────────────────────────────────────────────────┘
  363.           copy an entire source page to a destination page   
  364.  
  365.                                                              
  366. ┌────────────────────────────────────────────────────────────┐
  367. │ int     mtCopyBlk(int x1,int y1,int x2,int y2,int xoff,    │
  368. │                     int yoff,block src,block dest)         │
  369. └────────────────────────────────────────────────────────────┘
  370.           copy a rectangle block from the source page to a new
  371.           location in the destination page. The source and   
  372.           destination page can be the same.                  
  373.  
  374.  
  375. ┌────────────────────────────────────────────────────────────┐
  376. │ int     mtClipBlk(int *x1,int *y1,int *x2,int *y2)         │
  377. └────────────────────────────────────────────────────────────┘
  378.           clip a block with respect to the clip region
  379.  
  380.                                                    
  381. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  382. ▒                                                            ▒
  383. ▒ Block Routines                                             ▒
  384. ▒                                                            ▒
  385. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  386.                                                              
  387.  
  388. ┌────────────────────────────────────────────────────────────┐
  389. │ WGTSPRITE                                                  │
  390. │         **mtLoadWGT(char *filename,byte palette[])         │
  391. └────────────────────────────────────────────────────────────┘
  392.           load up the WGT sprite file                        
  393.                                                              
  394.                                                              
  395. ┌────────────────────────────────────────────────────────────┐
  396. │ int     mtSaveWGT(char *fontname,WGTSPRITE **sprite)       │
  397. └────────────────────────────────────────────────────────────┘
  398.           save a sprite file under WGT sprite file format    
  399.  
  400.  
  401. ┌────────────────────────────────────────────────────────────┐
  402. │ int     mtFreeWGT(WGTSPRITE **sprite)                      │
  403. └────────────────────────────────────────────────────────────┘
  404.           free the sprite blocks          
  405.                                                              
  406.                                                              
  407. ┌────────────────────────────────────────────────────────────┐
  408. │ SPRITE  **mtLoadBlit(char *filename,byte palette[])        │
  409. └────────────────────────────────────────────────────────────┘
  410.           load up the mtGraph sprite file                    
  411.                                                        
  412. ┌────────────────────────────────────────────────────────────┐
  413. │ int     mtSaveBlit(char *filename,SPRITE **sprite)         │
  414. └────────────────────────────────────────────────────────────┘
  415.           save a sprite file under mtGraph sprite file format
  416.  
  417.                                                           
  418. ┌────────────────────────────────────────────────────────────┐
  419. │ int     mtFreeBlit(SPRITE **sprite)                        │
  420. └────────────────────────────────────────────────────────────┘
  421.           free the sprite blocks          
  422.  
  423.     
  424. ┌────────────────────────────────────────────────────────────┐
  425. │ void    mtPutSprite(int x,int y,int width,int height,      │
  426. │                     byte far *buf)                         │
  427. └────────────────────────────────────────────────────────────┘
  428.           display a bitmap. Color 0 is not drawn             
  429.  
  430.      
  431. ┌────────────────────────────────────────────────────────────┐
  432. │ void    mtCPutSprite(int x,int y,int width,int height,     │
  433. │                      byte far *buf)                        │
  434. └────────────────────────────────────────────────────────────┘
  435.           same as above but performs clipping                
  436.                                                              
  437.                                                              
  438. ┌────────────────────────────────────────────────────────────┐
  439. │ void    mtPutBlit(int x,int y,int width,int height,        │
  440. │                   byte far *buf)                           │
  441. └────────────────────────────────────────────────────────────┘
  442.           display a bitmap but color 1 is copied to the screen
  443.  
  444.  
  445. ┌────────────────────────────────────────────────────────────┐
  446. │ void    mtRemoveBlit(SPRITE *sprite)                       │
  447. └────────────────────────────────────────────────────────────┘
  448.           display a bitmap but color 1 is copied to the screen
  449.                                                              
  450.                                                              
  451. ┌────────────────────────────────────────────────────────────┐
  452. │ void    mtCPutBlit(int x,int y,int width,int height,       │
  453. │                    char far *buf)                          │
  454. └────────────────────────────────────────────────────────────┘
  455.           same as above but performs clipping                
  456.  
  457.                                                              
  458. ┌────────────────────────────────────────────────────────────┐
  459. │ void    mtRemoveBlit(SPRITE *sprite)                       │
  460. └────────────────────────────────────────────────────────────┘
  461.           free the allocated memory for the sprite file
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.                                                                
  469.     
  470. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  471. ▒                                                            ▒
  472. ▒ Pixel Routines                                             ▒
  473. ▒                                                            ▒
  474. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  475.                                                              
  476.                                                              
  477. ┌────────────────────────────────────────────────────────────┐
  478. │ void    mtPutPixel(int x,int y,int color)                  │
  479. └────────────────────────────────────────────────────────────┘
  480.           puts a pixel with user-defined color at x,y        
  481.                                                              
  482.                                                              
  483. ┌────────────────────────────────────────────────────────────┐
  484. │ void    mtCPutPixel(int x,int y,int color)                 │
  485. └────────────────────────────────────────────────────────────┘
  486.           same as above but performs clipping                
  487.                                                              
  488.                                                              
  489. ┌────────────────────────────────────────────────────────────┐
  490. │ int     mtGetPixel(int x,int y)                            │
  491. └────────────────────────────────────────────────────────────┘
  492.           get the color of the pixel at x,y                    
  493.  
  494.  
  495.                                                           
  496. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  497. ▒                                                            ▒
  498. ▒ Line Routines                                              ▒
  499. ▒                                                            ▒
  500. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  501.                                                              
  502.                                                              
  503. ┌────────────────────────────────────────────────────────────┐
  504. │ void    mtLine(int x1,int y1,int x2,int y2,int color)      │
  505. └────────────────────────────────────────────────────────────┘
  506.           draw a line                                        
  507.                                                              
  508.                                                              
  509. ┌────────────────────────────────────────────────────────────┐
  510. │ void    mtCLine(int x1,int y1,int x2,int y2,int color)     │
  511. └────────────────────────────────────────────────────────────┘
  512.           draw a line but supports clipping                  
  513.                                                              
  514.                                                              
  515. ┌────────────────────────────────────────────────────────────┐
  516. │ void    mtHLine(int x1,int x2,int y1,int color)            │
  517. └────────────────────────────────────────────────────────────┘
  518.           draw a horizontal line but does not support clipping.
  519.           Advisable to use mtLine / mtCLine as alternative   
  520.                                                                
  521.                                               
  522. ┌────────────────────────────────────────────────────────────┐
  523. │ void    mtVLine(int x1,int y1,int y2,int color)            │
  524. └────────────────────────────────────────────────────────────┘
  525.           draw a vertical line but does not support clipping.
  526.           Advisable to use mtLine / mtCLine as alternative   
  527.                                                              
  528. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  529. ▒                                                            ▒
  530. ▒ Rectangle Routines                                         ▒
  531. ▒                                                            ▒
  532. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  533.                                                              
  534.                                                              
  535. ┌────────────────────────────────────────────────────────────┐
  536. │ void    mtRect(int x1,int y1,int x2,int y2,int color)      │
  537. └────────────────────────────────────────────────────────────┘
  538.           draw an outline of a rectangle                     
  539.                                                              
  540.                                                              
  541. ┌────────────────────────────────────────────────────────────┐
  542. │ void    mtCRect(int x1,int y1,int x2,int y2,int color)     │
  543. └────────────────────────────────────────────────────────────┘
  544.           same as above but clipped                          
  545.  
  546.                                                              
  547. ┌────────────────────────────────────────────────────────────┐
  548. │ void    mtFillRect(int x1,int y1,int x2,int y2,int color)  │
  549. └────────────────────────────────────────────────────────────┘
  550.           draw a filled rectangle                            
  551.                                                              
  552.                                                              
  553. ┌────────────────────────────────────────────────────────────┐
  554. │ void    mtCFillRect(int x1,int y1,int x2,int y2,int color) │
  555. └────────────────────────────────────────────────────────────┘
  556.           same as above but clipped                          
  557.                                                              
  558.                                                              
  559.                                                              
  560. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  561. ▒                                                            ▒
  562. ▒ Circle Routines                                            ▒
  563. ▒                                                            ▒
  564. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  565.                                                              
  566.                                                              
  567. ┌────────────────────────────────────────────────────────────┐
  568. │ void    mtCircle(int x,int y,int radius,int color)         │
  569. └────────────────────────────────────────────────────────────┘
  570.           draw a circle at x,y with radius and color           
  571.                                                         
  572.                                                              
  573. ┌────────────────────────────────────────────────────────────┐
  574. │ void    mtCCircle(int x,int y,int radius,int color)        │
  575. └────────────────────────────────────────────────────────────┘
  576.           same as above but performs clipping                  
  577.   
  578.                                                              
  579. ┌────────────────────────────────────────────────────────────┐
  580. │ void    mtFillCircle(int x,int y,int radius,int color)     │
  581. └────────────────────────────────────────────────────────────┘
  582.           draw a filled circle at x,y with radius and color    
  583.   
  584.                                                              
  585.                                                              
  586. ┌────────────────────────────────────────────────────────────┐
  587. │ void    mtCFillCircle(int x,int y,int radius,int color)    │
  588. └────────────────────────────────────────────────────────────┘
  589.           same as above but performs clipping                  
  590.   
  591.                                                              
  592.                                                              
  593. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  594. ▒                                                            ▒
  595. ▒ Ellipse Routine                                            ▒
  596. ▒                                                            ▒
  597. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  598.                                                              
  599.                                                              
  600. ┌────────────────────────────────────────────────────────────┐
  601. │ void    mtEllipse(int x,int y, int a, int b,int color)     │
  602. └────────────────────────────────────────────────────────────┘
  603.           draw an ellipse at x,y with major axis (a) and minor
  604.           axis (b)                                          
  605.                                                              
  606. ┌────────────────────────────────────────────────────────────┐
  607. │ void    mtCEllipse(int x,int y, int a, int b,int color)    │
  608. └────────────────────────────────────────────────────────────┘
  609.           draw an ellipse at x,y with major axis (a) and minor
  610.           axis (b). Supports clipping.                      
  611.                                                              
  612.                                                              
  613. ┌────────────────────────────────────────────────────────────┐
  614. │ void    mtFillEllipse(int x,int y, int a, int b,int color) │
  615. └────────────────────────────────────────────────────────────┘
  616.           draw a filled ellipse at x,y with major axis (a) and
  617.           minor axis (b)                                       
  618.                                                                
  619.                 
  620. ┌────────────────────────────────────────────────────────────┐
  621. │ void    mtCFillEllipse(int x,int y, int a, int b,int color)│
  622. └────────────────────────────────────────────────────────────┘
  623.           draw a filled ellipse at x,y with major axis (a) and
  624.           minor axis (b). Supports clipping.                   
  625.             
  626.  
  627.                                                             
  628. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  629. ▒                                                            ▒
  630. ▒ Font Routines                                              ▒
  631. ▒                                                            ▒
  632. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  633.                                                              
  634.                                                              
  635. ┌────────────────────────────────────────────────────────────┐
  636. │ mtFONT* mtLoadFont(char *fontname)                         │
  637. └────────────────────────────────────────────────────────────┘
  638.           load up the font type                                
  639.   
  640.  
  641. ┌────────────────────────────────────────────────────────────┐
  642. │ int     mtSaveFont(char *fontname,FONT *font)              │
  643. └────────────────────────────────────────────────────────────┘
  644.           save the user-define font type to the harddisk     
  645.                                                              
  646.                                                              
  647. ┌────────────────────────────────────────────────────────────┐
  648. │ void    mtFreeFont(FONT *font)                             │
  649. └────────────────────────────────────────────────────────────┘
  650.           remove the space allocated for the font            
  651.                                                              
  652. ┌────────────────────────────────────────────────────────────┐
  653. │ void       mtSetColor(byte color)                             │
  654. └────────────────────────────────────────────────────────────┘
  655.           change the font color                                
  656.                                                                    
  657. ┌────────────────────────────────────────────────────────────┐
  658. │ void    mtPutc(int x,int y,int c,FONT *font)               │
  659. └────────────────────────────────────────────────────────────┘
  660.           display a character at x,y                         
  661.                                                              
  662.                                                              
  663. ┌────────────────────────────────────────────────────────────┐
  664. │ void    mtPrintStr(int x,int y,char* str,FONT *font)       │
  665. └────────────────────────────────────────────────────────────┘
  666.           display a string starting at x,y                   
  667.                                                              
  668.                                                              
  669. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  670. ▒                                                            ▒
  671. ▒ Image File Routines                                        ▒
  672. ▒                                                            ▒
  673. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  674.                                                              
  675.                                                            
  676. ┌────────────────────────────────────────────────────────────┐
  677. │ int     mtLoadPCX(char *filename);                         │
  678. └────────────────────────────────────────────────────────────┘
  679.           load up a 320x200 256 colors PCX file              
  680.                                                                
  681.  
  682. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  683. ▒                                                            ▒
  684. ▒ Mouse Routines                                             ▒
  685. ▒                                                            ▒
  686. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  687.                                                              
  688.                                                              
  689. ┌────────────────────────────────────────────────────────────┐
  690. │ int     mtInitMouse()                                      │
  691. └────────────────────────────────────────────────────────────┘
  692.           Determine if mouse driver is present. If yes, reset
  693.                                                              
  694.                                                              
  695. ┌────────────────────────────────────────────────────────────┐
  696. │ void    mtShowMouse()                                      │
  697. └────────────────────────────────────────────────────────────┘
  698.           show the cursor                                    
  699.                                                              
  700.                                                              
  701. ┌────────────────────────────────────────────────────────────┐
  702. │ void    mtHideMouse()                                      │
  703. └────────────────────────────────────────────────────────────┘
  704.           hide the cursor                                    
  705.                                                              
  706.                                                              
  707. ┌────────────────────────────────────────────────────────────┐
  708. │ void    mtGetMousePos(int *button,int *x,int *y)           │
  709. └────────────────────────────────────────────────────────────┘
  710.           return the mouse position and the status of the button
  711.                                                              
  712.                                                              
  713. ┌────────────────────────────────────────────────────────────┐
  714. │ void    mtSetMousePos(int x,int y)                         │
  715. └────────────────────────────────────────────────────────────┘
  716.           set the cursor's position                          
  717.                                                              
  718.  
  719. ┌────────────────────────────────────────────────────────────┐
  720. │ int     mtGetMousePress(int button,int *count,int *x,int*y)│
  721. └────────────────────────────────────────────────────────────┘
  722.           determine the status of the button, the no. of time
  723.           pressed at which location.                         
  724.                                                             
  725. ┌────────────────────────────────────────────────────────────┐
  726. │ int     mtGetMouseRel(int button,int *count,int *x,int *y) │
  727. └────────────────────────────────────────────────────────────┘
  728.           determine the status of the button, the no of time 
  729.           released at which location                           
  730.                                                              
  731.  
  732. ┌────────────────────────────────────────────────────────────┐
  733. │ void    mtSetMouseWin(int x1,int y1,int x2,int y2)         │
  734. └────────────────────────────────────────────────────────────┘
  735.           set a window boundary for the mouse cursor         
  736.                                                              
  737.                                                              
  738. ┌────────────────────────────────────────────────────────────┐
  739. │ void    mtSetDefCursor()                                   │
  740. └────────────────────────────────────────────────────────────┘
  741.           set up the default cursor                          
  742.                                                              
  743.                                                              
  744. ┌────────────────────────────────────────────────────────────┐
  745. │ void    mtSetCursor(int *array)                            │
  746. └────────────────────────────────────────────────────────────┘
  747.           set up a 16x16 array as cursor                     
  748.                                                              
  749.                                                              
  750.  
  751. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  752. ▒                                                            ▒
  753. ▒ Palette Routines                                           ▒
  754. ▒                                                            ▒
  755. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  756.  
  757.                                                              
  758. ┌────────────────────────────────────────────────────────────┐
  759. │ int     mtSetCol(byte colindex,byte red,byte green,        │
  760. │                  byte blue                                 │
  761. └────────────────────────────────────────────────────────────┘
  762.      set the RGB color at color index.
  763. ┌────────────────────────────────────────────────────────────┐
  764. │ int     mtGetCol(byte colindex,byte red,byte green,        │
  765. │                  byte blue                                 │
  766. └────────────────────────────────────────────────────────────┘
  767.      get the RGB color at color index.  
  768.                                                              
  769.                                                              
  770. ┌────────────────────────────────────────────────────────────┐
  771. │ int     mtLoadPal(char *filename,byte palette[])           │
  772. └────────────────────────────────────────────────────────────┘
  773.           load a table of palette from the harddisk          
  774.                                                              
  775.                                                              
  776. ┌────────────────────────────────────────────────────────────┐
  777. │ int     mtSavePal(char *filename,byte palette[])           │
  778. └────────────────────────────────────────────────────────────┘
  779.           saves a table of palette                           
  780.                                                           
  781. ┌────────────────────────────────────────────────────────────┐
  782. │ void    mtClearPal(byte palette[])                         │
  783. └────────────────────────────────────────────────────────────┘
  784.           clear a palette table                              
  785.  
  786.  
  787. ┌────────────────────────────────────────────────────────────┐
  788. │ int     mtSetPal(byte pal[],byte start,byte end)           │
  789. └────────────────────────────────────────────────────────────┘
  790.      set the palette ranging from start index to the end index.
  791.  
  792.  
  793. ┌────────────────────────────────────────────────────────────┐
  794. │ int     mtBlackOut(void)                                   │
  795. └────────────────────────────────────────────────────────────┘
  796.      set the palette to black color.    
  797.      
  798. ┌────────────────────────────────────────────────────────────┐
  799. │ int     mtWhiten(void)                                     │
  800. └────────────────────────────────────────────────────────────┘
  801.      set the palette to 255 color.      
  802.  
  803.  
  804. ┌────────────────────────────────────────────────────────────┐
  805. │ int     mtGetAllPal(byte pal[])                            │
  806. └────────────────────────────────────────────────────────────┘
  807.      to extract the palette from the registers
  808.  
  809.                                                              
  810. ┌────────────────────────────────────────────────────────────┐
  811. │ void    mtFadeOut(int interval)                            │
  812. └────────────────────────────────────────────────────────────┘
  813.           to reduce the video palette to all zero at a certain
  814.           interval                                           
  815.                     
  816.  
  817.  
  818.                                          
  819.                                                              
  820. ┌────────────────────────────────────────────────────────────┐
  821. │ void    mtFadeIn(byte palette[],byte inc,int interval)     │
  822. └────────────────────────────────────────────────────────────┘
  823.           to increase the video palette from zero to the desired
  824.           palette                                            
  825.                                                              
  826.  
  827. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  828. ▒                                                            ▒
  829. ▒ Sound Routines (extremely primitive)                       ▒
  830. ▒                                                            ▒
  831. ▒ (Not particular sure if it work.. didn't test              ▒
  832. ▒                                                            ▒
  833. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  834.  
  835.  
  836. ┌────────────────────────────────────────────────────────────┐
  837. │ void    mtSound(int hertz, int duration)                   │
  838. └────────────────────────────────────────────────────────────┘
  839.           to make a sound
  840.  
  841.  
  842. ┌────────────────────────────────────────────────────────────┐
  843. │ void    mtClick(void)                                      │
  844. └────────────────────────────────────────────────────────────┘
  845.           to make a clicking sound
  846.  
  847.  
  848. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  849. ▒                                                            ▒
  850. ▒ Keyboard Routines                                          ▒
  851. ▒                                                            ▒
  852. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  853.  
  854.  
  855. ┌────────────────────────────────────────────────────────────┐
  856. │ void    mtKeyInst(void)                                    │
  857. └────────────────────────────────────────────────────────────┘
  858.           to install the keyboard handler
  859.  
  860.  
  861. ┌────────────────────────────────────────────────────────────┐
  862. │ void    mtKeyUninst(void)                                  │
  863. └────────────────────────────────────────────────────────────┘
  864.           to remove the keyboard handler
  865.                                                                
  866.                                                          
  867. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  868. ▒                                                            ▒
  869. ▒ Miscellaneous Routines                                     ▒
  870. ▒                                                            ▒
  871. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  872.                                                              
  873.                                                              
  874. ┌────────────────────────────────────────────────────────────┐
  875. │ void    mtWaitRetrace(void)                                │
  876. └────────────────────────────────────────────────────────────┘
  877.           wait for vertical retrace                          
  878.  
  879. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  880. ▒                                                            ▒
  881. ▒  References                                                ▒
  882. ▒                                                            ▒
  883. ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  884.  
  885.  
  886. ┌───────────────────┬────────────────────────────────────────┐
  887. │ Assembly Language │                                        │
  888. └───────────────────┴────────────────────────────────────────┘
  889. 1.   Auerbach, J. "IBM PC Assembly Language Tutorial", Article,
  890.      Unknown.
  891.  
  892. 2.   "Draeden", "Introduction to Assembler", Game Programming
  893.      Encyclopedia, 1993/94.
  894.  
  895. 3.   Murray III, W.H. and Pappas, C.H. "80386/80286 Assembly
  896.      Language Programming", Intl Edn, McGraw-Hill Inc, 1986.
  897.  
  898. 4.   Swan,T. "Mastering Turbo Assembler", Hayden Books, 1989.
  899.  
  900.                         
  901. ┌──────────┬─────────────────────────────────────────────────┐
  902. │ Graphics │                                                 │
  903. └──────────┴─────────────────────────────────────────────────┘
  904.  
  905. 1.   Foley, J.D., Van Dam, A., Feiner, S.K., Hughes, J.F.
  906.      "Computer Graphics : Principles and Practice", 2nd Edn,
  907.      Addison-Wesley, 1991.
  908.  
  909. 2.   Ferraro, R.F. "Programmer's Guide to the EGA and VGA
  910.      cards", 2nd Edn, Addison-Wesley, 1990.
  911.  
  912. 3.   Morley, M. "VGL20", Mode13h library
  913.  
  914. 4.   Smith, G. "VGA Trainers", Tutorials 1 - 11.
  915.  
  916. 5.   Sutty, G. and Blair, S. "Advanced Programmer's Guide to the
  917.      EGA/VGA", Brady Books, 1988.
  918.  
  919. 6.   Wilton, R. "Programmer Guide to PC & PS/2 Video Systems",
  920.      Microsoft Press, 1987.
  921.  
  922.  
  923. ┌────────┬───────────────────────────────────────────────────┐
  924. │ Others │                                                   │
  925. └────────┴───────────────────────────────────────────────────┘
  926.  
  927. 1.   Game Developers' Magazine by Phil Inch.
  928.  
  929. 2.   Game Programming Encyclopedia (PC-GPE) compiled by Mark
  930.      Feldman.
  931.  
  932. 3.   Kientzle, T. Algorithm Alley, "Dr.Dobb's Journal", pg 119- 
  933.                   ---------------                  
  934.      120, Vol. 19, Issue 7, Jul 1994.
  935.                                                         
  936.                                                              
  937.                                                              
  938.  
  939.  
  940.                                                              
  941.                                                              
  942.                                                              
  943.                                                              
  944.                                                              
  945.                                                              
  946.                                                              
  947.                                                              
  948.                                                              
  949.                                                              
  950.                                                              
  951.                                                              
  952.